tree.ui.Draggable = Class({
    
    make_draggable: function()
    {
        var widget = this;
        widget.htmlelem.draggable = true;
	
	    var id = (new Date()).getTime();
        widget.htmlelem.id = id;
	
	    widget.htmlelem.ondragstart = function(event)
	    {
            var style = window.getComputedStyle(event.target, null);
            var data = tree.io.formats.json.dump(
            {
                x: parseInt(style.getPropertyValue('left'),10) - event.clientX,
                y: parseInt(style.getPropertyValue('top'),10) - event.clientY,
                id: id,
            });
            event.dataTransfer.setData('text/plain', data);
	    };
	},
});
